From: Chad Horohoe Date: Wed, 13 Aug 2008 15:40:47 +0000 (+0000) Subject: (bug 15141) - Give "cascadeonly" checkbox on Special:ProtectedPages. X-Git-Tag: 1.31.0-rc.0~45917 X-Git-Url: http://git.cyclocoop.org/%28%5B%5E/404?a=commitdiff_plain;h=31a8d0757cd38999add713e9cdbb2f8126cd9690;p=lhc%2Fweb%2Fwiklou.git (bug 15141) - Give "cascadeonly" checkbox on Special:ProtectedPages. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index bedac2db93..5344cc0515 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -76,6 +76,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 15127) Work around minor display glitch in Opera. * By default, reject file uploads that look like ZIP files, to avoid the so-called GIFAR vulnerability. +* (bug 15141) Give ability to only list protected pages with the cascading + option enabled on Special:ProtectedPages === Bug fixes in 1.14 === diff --git a/includes/specials/SpecialProtectedpages.php b/includes/specials/SpecialProtectedpages.php index 3025c0559c..073309b7d0 100644 --- a/includes/specials/SpecialProtectedpages.php +++ b/includes/specials/SpecialProtectedpages.php @@ -32,10 +32,11 @@ class ProtectedPagesForm { $size = $wgRequest->getIntOrNull( 'size' ); $NS = $wgRequest->getIntOrNull( 'namespace' ); $indefOnly = $wgRequest->getBool( 'indefonly' ) ? 1 : 0; + $cascadeOnly = $wgRequest->getBool('cascadeonly') ? 1 : 0; - $pager = new ProtectedPagesPager( $this, array(), $type, $level, $NS, $sizetype, $size, $indefOnly ); + $pager = new ProtectedPagesPager( $this, array(), $type, $level, $NS, $sizetype, $size, $indefOnly, $cascadeOnly ); - $wgOut->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size, $indefOnly ) ); + $wgOut->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size, $indefOnly, $cascadeOnly ) ); if ( $pager->getNumRows() ) { $s = $pager->getNavigationBar(); @@ -111,10 +112,11 @@ class ProtectedPagesForm { * @param $level string * @param $minsize int * @param $indefOnly bool + * @param $cascadeOnly bool * @return string Input form * @private */ - protected function showOptions( $namespace, $type='edit', $level, $sizetype, $size, $indefOnly ) { + protected function showOptions( $namespace, $type='edit', $level, $sizetype, $size, $indefOnly, $cascadeOnly ) { global $wgScript; $title = SpecialPage::getTitleFor( 'ProtectedPages' ); return Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) . @@ -126,6 +128,7 @@ class ProtectedPagesForm { $this->getLevelMenu( $level ) . " \n" . "
  " . $this->getExpiryCheck( $indefOnly ) . " \n" . + $this->getCascadeCheck( $cascadeOnly ) . " \n" . $this->getSizeLimit( $sizetype, $size ) . " \n" . "" . " " . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" . @@ -153,6 +156,14 @@ class ProtectedPagesForm { return Xml::checkLabel( wfMsg('protectedpages-indef'), 'indefonly', 'indefonly', $indefOnly ) . "\n"; } + + /** + * @return string Formatted HTML + */ + protected function getCascadeCheck( $cascadeOnly ) { + return + Xml::checkLabel( wfMsg('protectedpages-cascade'), 'cascadeonly', 'cascadeonly', $cascadeOnly ) . "\n"; + } /** * @return string Formatted HTML @@ -237,7 +248,8 @@ class ProtectedPagesPager extends AlphabeticPager { public $mForm, $mConds; private $type, $level, $namespace, $sizetype, $size, $indefonly; - function __construct( $form, $conds = array(), $type, $level, $namespace, $sizetype='', $size=0, $indefonly=false ) { + function __construct( $form, $conds = array(), $type, $level, $namespace, $sizetype='', + $size=0, $indefonly = false, $cascadeonly = false ) { $this->mForm = $form; $this->mConds = $conds; $this->type = ( $type ) ? $type : 'edit'; @@ -246,6 +258,7 @@ class ProtectedPagesPager extends AlphabeticPager { $this->sizetype = $sizetype; $this->size = intval($size); $this->indefonly = (bool)$indefonly; + $this->cascadeonly = (bool)$cascadeonly; parent::__construct(); } @@ -281,6 +294,9 @@ class ProtectedPagesPager extends AlphabeticPager { if( $this->indefonly ) { $conds[] = "pr_expiry = 'infinity' OR pr_expiry IS NULL"; } + if ( $this->cascadeonly ) { + $conds[] = "pr_cascade = '1'"; + } if( $this->level ) $conds[] = 'pr_level=' . $this->mDb->addQuotes( $this->level ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 93286d6fe0..3a1d1ceacd 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1945,6 +1945,7 @@ Each row contains links to the first and second redirect, as well as the target 'protectedpages' => 'Protected pages', 'protectedpages-indef' => 'Indefinite protections only', 'protectedpages-summary' => '', # do not translate or duplicate this message to other languages +'protectedpages-cascade' => 'Cascading protections only', 'protectedpagestext' => 'The following pages are protected from moving or editing', 'protectedpagesempty' => 'No pages are currently protected with these parameters.', 'protectedtitles' => 'Protected titles', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 7b13710a46..9a7ac6d08f 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1227,6 +1227,7 @@ $wgMessageStructure = array( 'protectedpages', 'protectedpages-indef', 'protectedpages-summary', + 'protectedpages-cascade', 'protectedpagestext', 'protectedpagesempty', 'protectedtitles',